﻿using Inovout.Cloud.Applications.Security.Services;
using Inovout.Cloud.Models;
using Inovout.Cloud.Services;
using Inovout.Memberships;
using Inovout.Security;
using Inovout.Services;

namespace Inovout.Cloud.Web.Http
{
    public class CloudHttpController<TProjectObject> : CloudHttpController where TProjectObject : IProjectObject
    {
       
        //protected override bool AuthorizePublicApi(out IApplicationUser applicationUser, out IMembershipUser membershipUser)
        //{
        //    object appKey = null;
        //    //if (base.TryGetParameterValue("key", out appKey))
        //    //{
        //    //    PublicApiAccessCredentialService publicApiAccessCredentialService = ComponentRegistry.Resolve<PublicApiAccessCredentialService>();
        //    //    applicationUser = publicApiAccessCredentialService.FindByApiKey(appKey.ToString()).ApplicationUser;

        //    //    //todo: ApplicationUser->Application->Membership->Membershipuser;
        //    //    membershipUser = null;
        //    //    //membershipUser = ComponentRegistry.Resolve<IMembershipUserService>().FindByClaimedIdentifier(accessToken.User);


        //    //    Project = GetProject();

        //    //    return Project.Membership.Equals(membershipUser.Membership);
        //    //}
        //    base.TryGetParameterValue("key", out appKey);
        //    PublicApiAccessCredentialService publicApiAccessCredentialService = ComponentRegistry.Resolve<PublicApiAccessCredentialService>();
        //    applicationUser = publicApiAccessCredentialService.FindByApiKey(appKey.ToString()).ApplicationUser;

        //    //todo: ApplicationUser->Application->Membership->Membershipuser;
        //    membershipUser = null;
        //    //membershipUser = ComponentRegistry.Resolve<IMembershipUserService>().FindByClaimedIdentifier(accessToken.User);
           
        //    membershipUser = null;
        //    return false;
        //}

    }

}